﻿/************************************************************************

   Extended Silverlight Toolkit

   Copyright (C) 2010-2012 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://extendedsilverlight.codeplex.com/license

   Please purchase a commercial version of this toolkit if you are using
   it in a commercial product. The commercial versions support the project,
   and also include more features for each control, priority support,
   source code, updates, removed watermark, and a proprietary license.

   Visit http://xceed.com and follow @datagrid on Twitter.

  **********************************************************************/

using System;
using System.Windows;
using Xceed.Silverlight.Data;

namespace Xceed.Silverlight.ListBox
{
  [System.Diagnostics.DebuggerDisplay( "DataPath {DataPath}, TargetPosition {TargetPosition}, OpacityFactor {OpacityFactor}, ScalingFactor {ScalingFactor}" )]
  internal class ContainerDescription : IEquatable<ContainerDescription>
  {
    #region Contructor

    internal ContainerDescription()
    {
      this.Configuration = null;
      m_targetPosition = new Point( 0.0d, 0.0d );
    }

    #endregion

    #region Configuration Property

    internal ListBoxContainerConfigurationBase Configuration
    {
      get;
      set;
    }

    #endregion

    #region OpacityFactor Property

    internal double OpacityFactor
    {
      get;
      set;
    }

    #endregion

    #region ScalingFactor Property

    internal double ScalingFactor
    {
      get;
      set;
    } 

    #endregion

    #region RotateAngle Property

    internal double RotateAngle
    {
      get;
      set;
    }

    #endregion

    #region TargetPosition Property

    internal Point TargetPosition
    {
      get
      {
        return m_targetPosition;
      }

      set
      {
        if( value != null )
        {
          m_targetPosition = value;
        }
      }


    }

    private Point m_targetPosition;

    #endregion

    #region DataPath Property

    internal DataPath DataPath
    {
      get;
      set;
    }

    #endregion

    #region Rect Property

    internal Rect Rect
    {
      get 
      {
        return new Rect( this.TargetPosition,
                         this.Configuration.PrepareSize );
      }
    }

    #endregion

    #region ProportionInEffectiveViewport Property
    internal double ProportionInEffectiveViewport
    {
      get;
      set;
    }
    #endregion

    #region ZIndex Property

    internal int ZIndex
    {
      get;
      set;
    } 

    #endregion

    #region ScrollIndexAsTopItem Property

    internal double ScrollIndexAsTopItem
    {
      get;
      set;
    }

    #endregion

    #region ScrollIndexAsBottomItem Property

    internal double ScrollIndexAsBottomItem
    {
      get;
      set;
    }

    #endregion

    #region IEquatable<ContainerDescription> Members

    bool IEquatable<ContainerDescription>.Equals( ContainerDescription other )
    {
      if( other == null )
        return false;

      object otherDataPath = other.DataPath;
      object dataPath = this.DataPath;

      if( ( dataPath == null ) && ( otherDataPath == null ) )
        return true;

      if( dataPath != null )
        return dataPath.Equals( otherDataPath );

      return false;
    }

    #endregion
  }
}
